<template>
    <div class="test-container">
        <!-- 图表 -->
        <div id="myChart"></div>
        <div @click.stop = "clickbtn()" class="click-btn">
                点我呀
        </div>
        <!-- 加载ICON -->
        <div class="load-icon">
            <span>正在加载</span><mt-spinner type="fading-circle" color="#26a2ff" :size="30"></mt-spinner>
        </div>
    </div>
</template>
<script type="text/javascript">
    import { MessageBox } from 'mint-ui'

    export default {
        name: 'hello',
        data () {
            return {
               
            }
        },
        mounted(){
            this.drawLine();
        },
        methods: {
            drawLine(){
                // 基于准备好的dom，初始化echarts实例
                let myChart = this.$echarts.init(document.getElementById('myChart'))
                // 绘制图表
                myChart.setOption({
                    title: { 
                        text: '在Vue中使用echarts',
                        x: 'center'
                    },
                    tooltip: {},
                    xAxis: {
                        data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
                    },
                    yAxis: {},
                    series: [{
                        name: '销量',
                        type: 'bar',
                        data: [5, 20, 36, 10, 10, 20]
                    }]
                });
            },
            clickbtn(){
                this.$http.post("http://localhost:8888/mes/sysDictionary/selectTree",{})
                .then(
                    (response)=>{
                    console.log(response.body.responseData);
                    // console.log(JSON.parse(response.body.responseData));
                    },
                    (error)=>{
                    console.log(error);
                    }
                );
            },
        }
    }
</script>
<style type="text/css">
    .test-container{
        position: absolute;
        top: 40px;
        width:100%;
        height: calc(100% - 95px);
        overflow-y: scroll;
    }
    #myChart{
        width: 100%;
		height: 300px;
		margin: 20px auto;
		background-color: #ccc;
		border-radius: 5px;
		box-shadow: 1px 1px 2px #efefef;
    }
    .click-btn{
		width: 200px;
		height: 50px;
		margin: 50px auto;
		background-color: #F62929;
		line-height: 50px;
		color: #ffffff;
		font-size: 20px;
		text-align: center;
		border-radius: 5px;
		box-shadow: 1px 1px 2px #efefef;
	}
    .load-icon{
        width: 100px;
        margin: 10px auto 5px auto;
    }
    .load-icon span{
        float: right;
        line-height: 30px;
        margin-left: 5px;
        color: #c1c1c1;
    }
</style>